import { Meta } from '@storybook/blocks';

import * as DropdownButtonStories from '../stories/DropdownButton.stories';

<Meta of={DropdownButtonStories} />

# DropdownButton

A material design button for selecting from a list of items.

## Example

```dart liveslice=DropdownButton
String dropdownValue = 'One';

@override
Widget build(BuildContext context) {
  return Scaffold(
    body: Center(
      child: DropdownButton<String>(
        value: dropdownValue,
        onChanged: (String newValue) {
          setState(() {
            dropdownValue = newValue;
          });
        },
        items: <String>['One', 'Two', 'Free', 'Four']
          .map<DropdownMenuItem<String>>((String value) {
            return DropdownMenuItem<String>(
              value: value,
              child: Text(value),
            );
          })
          .toList(),
      ),
    ),
  );
}
```

## Related Links

- https://api.flutter.dev/flutter/material/DropdownButton-class.html
